package com.spider.iceCream.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author Lord
 * @date 2021/7/20 9:06
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.spider.iceCream.controller"))
                .paths(PathSelectors.any())
                .build().apiInfo(new ApiInfoBuilder()
                        .title("SpringBoot整合Swagger")
                        .description("接口文档描述信息......")
                        .version("1.0")
                        .contact(new Contact("lby","https://gray7.asia","1015118305@qq.com"))
                        .license("82.156.23.40")
                        .licenseUrl("82.156.23.40")
                        .build());
    }


//    private ApiInfo apiInfo() {
//        return new ApiInfoBuilder()
//                // 标题
//                .title("Spring Boot中使用Swagger2构建RESTful API")
//                // 描述信息
//                .description("rest api 文档构建利器")
//                //服务网址
//                .termsOfServiceUrl("http://blog.csdn.net/itguangit")
//                //版本号
//                .version("1.0")
//                .build();
//    }


}
